using System;
using System.Data;
using System.Collections;

namespace RMAS.DAL
{
    /// <summary>
    /// Summary description for QT_EXPORTBILL.
    /// </summary>
    public class QT_EXPORTBILLList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public QT_EXPORTBILLList()
    	{
	    }

		public void Add(QT_EXPORTBILL entity)
		{
            this.List.Add(entity);
		}

		public void Add(QT_EXPORTBILLList list)
		{	
			foreach(QT_EXPORTBILL entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual QT_EXPORTBILL this[int index]
		{
		    get
			{
				return (QT_EXPORTBILL)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual QT_EXPORTBILL Find(string BillID)
	{
	    foreach (QT_EXPORTBILL obj in this.List)
	    {
		if(obj.BillID.ToString().ToUpper().Trim() == BillID.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual QT_EXPORTBILLList FindListByBillID(string BillID)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
		    if(obj.BillID.ToString().ToUpper().Trim() == BillID.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual QT_EXPORTBILL FindByTypeBill(string TypeBill)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.TypeBill.ToString().ToUpper().Trim() == TypeBill.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByExportDate(DateTime ExportDate)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.ExportDate.ToString().ToUpper().Trim() == ExportDate.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByPayID(Int32 PayID)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.PayID.ToString().ToUpper().Trim() == PayID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByNote(string Note)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.Note.ToString().ToUpper().Trim() == Note.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByTableID(string TableID)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.TableID.ToString().ToUpper().Trim() == TableID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByPromotionID(string PromotionID)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.PromotionID.ToString().ToUpper().Trim() == PromotionID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByPromotionMoney(decimal PromotionMoney)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.PromotionMoney.ToString().ToUpper().Trim() == PromotionMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByVAT(double VAT)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.VAT.ToString().ToUpper().Trim() == VAT.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByTableMoney(decimal TableMoney)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.TableMoney.ToString().ToUpper().Trim() == TableMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByServiceMoney(decimal ServiceMoney)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.ServiceMoney.ToString().ToUpper().Trim() == ServiceMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByOtherMoney(decimal OtherMoney)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.OtherMoney.ToString().ToUpper().Trim() == OtherMoney.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByTotalPay(double TotalPay)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.TotalPay.ToString().ToUpper().Trim() == TotalPay.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByCusID(string CusID)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.CusID.ToString().ToUpper().Trim() == CusID.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByCusName(string CusName)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.CusName.ToString().ToUpper().Trim() == CusName.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByPaymented(double Paymented)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.Paymented.ToString().ToUpper().Trim() == Paymented.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByUserName(string UserName)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.UserName.ToString().ToUpper().Trim() == UserName.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual QT_EXPORTBILL FindByIDPOS(string IDPOS)
        {
	        foreach (QT_EXPORTBILL obj in this.List)
	        {
		        if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual QT_EXPORTBILLList FindListByTypeBill(string TypeBill)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.TypeBill.ToString().ToUpper().Trim() == TypeBill.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByExportDate(DateTime ExportDate)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.ExportDate.ToString().ToUpper().Trim() == ExportDate.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByPayID(Int32 PayID)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.PayID.ToString().ToUpper().Trim() == PayID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByNote(string Note)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.Note.ToString().ToUpper().Trim() == Note.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByTableID(string TableID)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.TableID.ToString().ToUpper().Trim() == TableID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByPromotionID(string PromotionID)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.PromotionID.ToString().ToUpper().Trim() == PromotionID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByPromotionMoney(decimal PromotionMoney)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.PromotionMoney.ToString().ToUpper().Trim() == PromotionMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByVAT(double VAT)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.VAT.ToString().ToUpper().Trim() == VAT.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByTableMoney(decimal TableMoney)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.TableMoney.ToString().ToUpper().Trim() == TableMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByServiceMoney(decimal ServiceMoney)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.ServiceMoney.ToString().ToUpper().Trim() == ServiceMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByOtherMoney(decimal OtherMoney)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.OtherMoney.ToString().ToUpper().Trim() == OtherMoney.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByTotalPay(double TotalPay)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.TotalPay.ToString().ToUpper().Trim() == TotalPay.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByCusID(string CusID)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.CusID.ToString().ToUpper().Trim() == CusID.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByCusName(string CusName)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.CusName.ToString().ToUpper().Trim() == CusName.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByPaymented(double Paymented)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.Paymented.ToString().ToUpper().Trim() == Paymented.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByUserName(string UserName)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.UserName.ToString().ToUpper().Trim() == UserName.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual QT_EXPORTBILLList FindListByIDPOS(string IDPOS)
{
	try
	{
		QT_EXPORTBILLList List = new QT_EXPORTBILLList();
		foreach (QT_EXPORTBILL obj in this.List)
		{
			if(obj.IDPOS.ToString().ToUpper().Trim() == IDPOS.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(QT_EXPORTBILLList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public QT_EXPORTBILL Current
			{
				get
				{
					return (QT_EXPORTBILL)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (QT_EXPORTBILL)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}